package com.qf.hystrixdemo;

import org.springframework.web.client.RestTemplate;

/**
 * 测试熔断
 * 默认10s秒中之内至少有20个请求，50%的请求出现异常或超时，断路器开
 */
public class TestBreak {

    public static void main(String[] args) {

        RestTemplate restTemplate = new RestTemplate();

        String url = "http://192.168.20.41:9600/test1?num=3";

        for (int i=0;i<9;i++) {
            Thread thread = new Thread(new Runnable() {
                @Override
                public void run() {
                    String result = restTemplate.getForObject(url, String.class);
                    System.out.println(result);
                }
            });
            thread.start();

        }

    }

}
